﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <BooleanToVisibilityConverter x:Key="bvc" />
    <Style x:Key="LinkButton" 
       TargetType="Button"
       BasedOn="{StaticResource ResourceKey={x:Type Button}}">

        <Setter Property="Width" Value="Auto"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <ContentPresenter Content="{TemplateBinding Content}" 
                                  ContentTemplate="{TemplateBinding  ContentTemplate}"
                                  VerticalAlignment="Center"
                                  >
                        <ContentPresenter.Resources>
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="TextDecorations" Value="Underline" />
                            </Style>
                        </ContentPresenter.Resources>
                    </ContentPresenter>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="Blue" />
        <Setter Property="Cursor" Value="Hand" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Foreground" Value="Red" />
            </Trigger>
        </Style.Triggers>
    </Style>
    
    
    <!-- ShapeFileLayerDataTemplate -->
    <DataTemplate x:Key="ShapeFileLayerDataTemplate">

        <GroupBox x:Name="grpSettings"
                  Header="Shapefile layer settings"
                  Background="White"
                  Grid.Row="1"
                  Grid.Column="1"
                  Margin="3"
                  HorizontalAlignment="Stretch"
                  VerticalAlignment="Stretch"
                  Visibility="Visible">
            <Grid Margin="20">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="35" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0"
                           Grid.Row="0"
                           Margin="5">Shapefile path :</TextBlock>
                <Grid  Grid.Column="1"
                       Grid.Row="0"
                       Margin="10,5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBox x:Name="txtPath"
                             Grid.Column="0"
                             Text="{Binding ShapeFilePath, Mode=TwoWay, ValidatesOnDataErrors=True}"></TextBox>
                    <Button Grid.Column="1" Content="..."
                            Command="{Binding OpenShapefileCommand}" Width="20" Margin="2,0,0,0"/>
                </Grid>
                <Border CornerRadius="2"
                Grid.Column="0"
                           Grid.ColumnSpan="2"
                           Margin="5,0,5,5"
                           Grid.Row="1"
                        Background="#FFF9FFD4">
                    <TextBlock 
                           TextWrapping="Wrap" Margin="2">
                 Shapefile must point to .shp file. Make sure corresponding .dbf, .shx, and .prj files are at the same location.</TextBlock>
                </Border>
                <TextBlock Grid.Column="0" Grid.Row="3" Margin="5" Text="Coordinate System: "/>
                <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="3" Margin="10,5">
                    <TextBlock Text="{Binding CoordSysInfo}" TextWrapping="Wrap" />
                    <Button Margin="5,0,0,0" Content="View CoordSys" Style="{StaticResource LinkButton}" Visibility="{Binding IsCoordSysValid, Converter={StaticResource bvc}}"
                            Command="{Binding ShowCoordSysCommand}"/>
                </StackPanel>
            </Grid>
        </GroupBox>

    </DataTemplate>

</ResourceDictionary>